package com.ruoyi.system.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseIdEntity;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

/**
 * 用户提现记录对象 yh_member_withdrawal_records
 * 
 * @author ruoyi
 * @date 2023-06-06
 */
@Data
@ApiModel(value = "YhMemberWithdrawalRecords", description = "用户提现记录对象")
public class YhMemberWithdrawalRecords extends BaseIdEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    @ApiModelProperty("id")
    private String id;

    /** 会员ID */
    @Excel(name = "会员ID")
    @ApiModelProperty("会员ID")
    private String memberId;

    /** 提现来源（积分：POINT，佣金：COMMISSION） */
    @Excel(name = "提现来源", readConverterExp = "积=分：POINT，佣金：COMMISSION")
    @ApiModelProperty("提现来源（积分：POINT，佣金：COMMISSION）")
    private String withdrawalSource;

    /** 提现金额 */
    @Excel(name = "提现金额")
    @ApiModelProperty("提现金额")
    private Double withdrawalPrice;

    /** 使用积分 */
    @Excel(name = "使用积分")
    @ApiModelProperty("使用积分")
    private Double usePoint;

    /** 收款码图片地址 */
    @Excel(name = "收款码图片地址")
    @ApiModelProperty("收款码图片地址")
    private String imgUrl;

    /** 状态（1：申请中，2：已完成，3：已拒绝） */
    @Excel(name = "状态", readConverterExp = "1=：申请中，2：已完成，3：已拒绝")
    @ApiModelProperty("状态（1：申请中，2：已完成，3：已拒绝）")
    private Integer state;

    /** 备注 */
    @Excel(name = "备注")
    @ApiModelProperty("备注")
    private String remarks;

    @ApiModelProperty("会员昵称")
    @TableField(exist = false)
    private String nickName;

    /** 创建时间 */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    /** 更新时间 */
    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public <T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> wrapper=new QueryWrapper<>();

        wrapper.eq(StringUtils.isNotEmpty(id),"id" , id);
        wrapper.eq(StringUtils.isNotEmpty(memberId),"member_id" , memberId);
        wrapper.eq(StringUtils.isNotEmpty(withdrawalSource),"withdrawal_source" , withdrawalSource);
        wrapper.eq(withdrawalPrice != null,"withdrawal_price" , withdrawalPrice);
        wrapper.eq(usePoint != null,"use_point" , usePoint);
        wrapper.eq(StringUtils.isNotEmpty(imgUrl),"img_url" , imgUrl);
        wrapper.eq(state != null,"state" , state);
        wrapper.eq(StringUtils.isNotEmpty(remarks),"remarks" , remarks);

        wrapper.orderByDesc("create_time");
        return wrapper;
    }

}
